//
//  StoreReusableView.m
//  jingdongfang
//
//  Created by MTiMac01 on 2018/1/8.
//  Copyright © 2018年 LJL. All rights reserved.
//

#import "StoreReusableView.h"

@interface StoreReusableView ()
@property (nonatomic, strong)UIButton *moreBtn;
@property (nonatomic, strong)UILabel *titleLable;
@end

@implementation StoreReusableView

- (UILabel *)titleLable
{
    if (!_titleLable)
    {
        self.titleLable = [[UILabel alloc] init];
        self.titleLable.font = [UIFont font18];
        self.titleLable.textColor = [UIColor c4Color];
        self.titleLable.textAlignment = NSTextAlignmentCenter;
    }
    return _titleLable;
}

- (UIButton *)moreBtn
{
    if (!_moreBtn)
    {
        self.moreBtn = [[UIButton alloc] init];
        [self.moreBtn setImage:[UIImage imageNamed:@"share_parent"] forState:UIControlStateNormal];
        [self.moreBtn setImage:[UIImage imageNamed:@"share_parent"] forState:UIControlStateSelected];
        self.moreBtn.backgroundColor = [UIColor whiteColor];
        [self.moreBtn addTarget:self action:@selector(clickShowMoreBtn:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _moreBtn;
}

- (void)setTitleL:(NSString *)titleL
{
    self.titleLable.text = titleL;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    [self addSubview:self.moreBtn];
    [self addSubview:self.titleLable];
    self.backgroundColor = [UIColor c3Color];
    @KWeakObj(self);
    [self.moreBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.mas_equalTo(24);
        make.centerY.mas_equalTo(selfWeak);
        make.right.mas_equalTo(-15);

    }];
    [self.titleLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(200);
        make.height.mas_equalTo(selfWeak.height);
        make.centerX.mas_equalTo(selfWeak);
    }];
}

- (void)clickShowMoreBtn:(UIButton *)btn
{
    self.block(btn);
}

@end
